function m = nanmean(a)
%  Calculate Mean value ignoring NaNs.

notNanValues=a(~isnan(a));
m=sum(notNanValues)./length(notNanValues);